<?php get_header() ?>

<div class="content-header"></div>

<div id="content">
	<?php do_action( 'template_notices' ) // (error/success feedback) ?>

	<div id="dpa">
		<div id="dpa-graphs">
		<?php
		global $bp;

		if ( bp_is_home() ) { $user_id = $bp->loggedin_user->id; } else { $user_id = $bp->displayed_user->id; }	
		dpa_draw_overallcompletiondetails( $user_id );
		dpa_draw_categorycompletiondetails( $user_id );
		?>
		</div>

		<?php if ( dpa_has_user_earnt_any_achievements( $user_id ) ) { ?>
		<h2>Recent Achievements</h2>
			<?php
			$recent_achievements = dpa_get_list_of_ea_shortnames( $user_id, 5 );
			foreach ( $recent_achievements as $name ) {
				$a = dpa_get( 'nice_name,description,points', array( array( 'type' => 's', 'key' => 'short_name', 'value' => $name ) ), 1 );
				$e = dpa_get_ea_details( $user_id, $name ); ?>
				<div><span class="dpa-title"><?php echo apply_filters( 'dpa_filter_achievement_text', $a['nice_name'] ); ?> </span><?php echo apply_filters( 'dpa_filter_achievement_text', $a['description'] ); ?> <span class="dpa-timestamp"><?php echo apply_filters( 'dpa_filter_achievement_text', mysql2date( get_option( 'date_format' ), $e['achieved_at'] ) ); ?> - <?php echo apply_filters( 'dpa_filter_achievement_text', $a['points'] ) . __(' points', 'dp-achievements'); ?></span></div>
			<?php } // dpa_has_user_earnt_any_achievements
		} // dpa_user_has_earnt_achievements ?>
	</div>
</div>

<?php get_footer() ?>